import 'package:flutter/material.dart';

import 'index_data.dart';

var textStyle = TextStyle(
  color: Colors.black54,
);

class ItemWidget extends StatelessWidget {
  final InfoItem data;

  const ItemWidget(this.data, {Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        Navigator.of(context).pushNamed('roomPro');
      },
      child: Container(
        height: 90.0,
        padding: EdgeInsets.only(left: 10.0, right: 10.0, bottom: 10.0),
        //左右布局
        child: Row(
          children: [
            //左
            // CommonImage(data.imageUri),

            Image.network(
              data.imageUri,
              fit: BoxFit.fill,
              width: 120.0,
              height: 90.0,
            ),
            Padding(
              padding: EdgeInsets.only(left: 30.0),
            ),
            //右  随着屏幕宽度自动填充 expanded
            Expanded(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  //右侧的左右结构r
                  Text(
                    data.title,
                    style: TextStyle(
                        fontWeight: FontWeight.w600, color: Colors.black),
                  ),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    //crossAxisAlignment: CrossAxisAlignment.end,
                    children: [
                      Text(
                        data.source,
                        style: textStyle,
                      ),
                      Text(data.time, style: textStyle)
                    ],
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
